﻿
CREATE PROCEDURE [dbo].[proc_CallCenter_Create]
	(
		@CompanyId int,
		@DepartmentId int,
		@ZXNum int,
		@FJNum int,
		@UserName nvarchar(50),
		@EName nvarchar(50)
	)
AS
Begin
	Declare @nCount int
	Select @nCount=Count(0) From CallCenter Where CompanyId=@CompanyId And (FJNum=@FJNum Or ZXNum=@ZXNum)

	If @nCount = 0
		Insert Into CallCenter
		(
			CompanyId,
			DepartmentId,
			ZXNum,
			FJNum,
			UserName,
			EName
		)
		Values
		(
			@CompanyId,
			@DepartmentId,
			@ZXNum,
			@FJNum,
			@UserName,
			@EName
		)
End